<template>
  <div>
    <h1>通过泛型参数来定义 props 的类型</h1>
    <p>{{ props.title }}</p>
    <p>{{ props.user }}</p>
    <p>{{ props.msg }}</p>
  </div>
</template>

<script lang="ts" setup>
// const props = defineProps({
//   title:String,
//   user:Object,
//   msg:String
// })

//使用泛型来定义props的类型
export interface Iuser {
  id?: number;
  name: string;
  age: number;
  sex: string;
}
const props = defineProps<{
  title: string;
  user: Iuser;
  msg: string;
}>();
</script>
